package com.group.transaction.controller;

import com.alibaba.fastjson.JSONObject;
import com.group.transaction.aspect.InMethod;
import com.group.transaction.domain.Product;
import com.group.transaction.service.product.ProductService;
import lombok.Data;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/product")
@Data
public class ProductController {
    @Resource
    private ProductService productService;

    /**
     *添加产品
     * @return
     */
    @PostMapping("/addProduct")
    @InMethod(apiName = "添加产品")
    public JSONObject addProduct(Product product) {
        return productService.addProduct(product);
    }

    /**
     * 编辑产品
     * @return
     */
    @PostMapping("/compileProdduct")
    @InMethod(apiName = "编辑产品")
    public JSONObject compileProdduct(Product product) {
        return productService.compileProdduct(product);
    }

    /**
     * 删除产品
     * @return
     */
    @PostMapping("/deleteProduct")
    @InMethod(apiName = "删除产品")
    public JSONObject deleteProduct(Product product) {
        return productService.deleteProduct(product);
    }

    /**
     * 查询产品
     * @return
     */
    @PostMapping("/queryProductData")
    @InMethod(apiName = "查询产品")
    public JSONObject queryProductData(Product product) {
        return productService.queryProductData(product);
    }

    /**
     * 查询产品详情
     * @return
     */
    @PostMapping("/queryProductDetail")
    @InMethod(apiName = "查询产品详情")
    public JSONObject queryProductDetail(Integer productId) {
        return productService.queryProductDetail(productId);
    }

    /**
     * 添加图片
     * @return
     */
    @PostMapping("/添加图片")
    @InMethod(apiName = "addProductImage")
    public JSONObject addProductImage() {
        return new JSONObject().fluentPut("result", -1);
    }

    /**
     *  删除图片
     * @return
     */
    @PostMapping("/deleteProductImage")
    @InMethod(apiName = "删除图片")
    public JSONObject deleteProductImage() {
        return new JSONObject().fluentPut("result", -1);
    }

    /**
     *  添加购物车
     * @return
     */
    @PostMapping("/addCatShapping")
    @InMethod(apiName = "添加购物车")
    public JSONObject addCatShapping() {
        return new JSONObject().fluentPut("result", -1);
    }

    /**
     * 删除购物车
     * @return
     */
    @PostMapping("/deleteCatShapping")
    @InMethod(apiName = "删除购物车")
    public JSONObject deleteCatShapping() {
        return new JSONObject().fluentPut("result", -1);
    }

    /**
     * 保存评价信息
     * @return
     */
    @PostMapping("/addProductEvaluate")
    @InMethod(apiName = "保存评价信息")
    public JSONObject addProductEvaluate() {
        return new JSONObject().fluentPut("result", -1);
    }

    /**
     * 删除评价信息
     * @return
     */
    @PostMapping("/deleteProductEvaluate")
    @InMethod(apiName = "删除评价信息")
    public JSONObject deleteProductEvaluate() {
        return new JSONObject().fluentPut("result", -1);
    }

    /**
     * 添加订单
     * @return
     */
    @PostMapping("/addOrder")
    @InMethod(apiName = "添加订单")
    public JSONObject addOrder() {
        return new JSONObject().fluentPut("result", -1);
    }

    /**
     * 编辑订单
     * @return
     */
    @PostMapping("/compileOrder")
    @InMethod(apiName = "编辑订单")
    public JSONObject compileOrder() {
        return new JSONObject().fluentPut("result", -1);
    }

    /**
     * 删除订单
     * @return
     */
    @PostMapping("/deleteOrder")
    @InMethod(apiName = "删除订单")
    public JSONObject deleteOrder() {
        return new JSONObject().fluentPut("result", -1);
    }

    /**
     * 查询历史订单
     * @return
     */
    @PostMapping("/queryHistoryOrder")
    @InMethod(apiName = "查询历史订单")
    public JSONObject queryHistoryOrder() {
        return new JSONObject().fluentPut("result", -1);
    }

    /**
     * 添加产品类型
     * @return
     */
    @PostMapping("/addProductType")
    @InMethod(apiName = "添加产品类型")
    public JSONObject addProductType() {
        return new JSONObject().fluentPut("result", -1);
    }

    /**
     * 编辑产品类型
     * @return
     */
    @PostMapping("/compileProductType")
    @InMethod(apiName = "编辑产品类型")
    public JSONObject compileProductType() {
        return new JSONObject().fluentPut("result", -1);
    }

    /**
     * 保存产品类型
     * @return
     */
    @PostMapping("/deleteProductType")
    @InMethod(apiName = "保存产品类型")
    public JSONObject deleteProductType() {
        return new JSONObject().fluentPut("result", -1);
    }
}
